<!--
 * @Author: WLang
 * @LastEditors: WLang
 * @Description: 
 * @Date: 2023-07-13 18:14:53
 * @LastEditTime: 2023-07-15 17:41:42
 * @FilePath: \myblog\src\mviews\components\SearchBar.vue
-->
<template>
      <van-search v-model="value" @search="onSearch" show-action placeholder="请输入搜索关键词"  shape="round">
      <template #action>
        <div @click="onSearch">搜索</div>
      </template>
    </van-search>
</template>

<script>
import { Notify } from 'vant'
export default {
  components:{},
  data(){
    return {
      value: ''
    }
  },
created(){},
mounted(){},
watch:{},
computed:{},
methods:{
  onSearch() {
    if(this.value.trim().length === 0)
    {
      Notify({
        type: 'warning',
        message: '请输入搜索关键字'
      })
      return 
    }
    this.$EventBus.$emit('search-article', this.value);
    this.value = '';
  }
},
}
</script>
<style  scoped>
</style>